<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../jquery-3.3.1.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        ul>li>span {
            width: 100px;
            height: 30px;
            float: left;
            background-color: blueviolet;
        }
        
        ul>li>a {
            width: 100px;
            height: 30px;
            float: left;
            background-color: blueviolet;
        }
        
        li {
            list-style: none;
        }
        
        a {
            text-decoration: none;
            color: black;
        }
        
        ul>li>ul>li {
            width: 100px;
            height: 30px;
        }
        
        .wrap>ul>li {
            position: relative;
        }
        
        ul>li>ul {
            top: 30px;
            display: none;
            position: absolute;
        }
    </style>
</head>

<body>
    <div class="wrap">
        <ul>
            <li>
                <span>一级菜单1</span>
                <ul>
                    <li><a href="javascript:void(0);">二级菜单1</a></li>
                    <li><a href="javascript:void(0);">二级菜单2</a></li>
                    <li><a href="javascript:void(0);">二级菜单3</a></li>
                </ul>
            </li>
            <li>
                <span>一级菜单2</span>
                <ul>
                    <li><a href="javascript:void(0);">二级菜单11</a></li>
                    <li><a href="javascript:void(0);">二级菜单22</a></li>
                    <li><a href="javascript:void(0);">二级菜单33</a></li>
                </ul>
            </li>
            <li>
                <span>一级菜单3</span>
                <ul>
                    <li><a href="javascript:void(0);">二级菜单13</a></li>
                    <li><a href="javascript:void(0);">二级菜单23</a></li>
                    <li><a href="javascript:void(0);">二级菜单33</a></li>
                </ul>
            </li>
        </ul>
    </div>
    <script>
        var lis = $(".wrap ul li ul").toArray();
        for (var i = 0; i <= lis.length; i++) {
            $(lis[i]).css("left", i * 100);
        }
        $(".wrap ul li").mouseenter(function() {
            $(this).children('ul').stop().slideDown(300);
        })
        $(".wrap ul li").mouseleave(function() {
            $(this).find('ul').stop().slideUp(50);
        })
    </script>
</body>

</html>